﻿using System;

namespace FirstFloor.P2P.Reversi
{
    /// <summary>
    /// Represents a board piece
    /// </summary>
    public class Piece
        : Location
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Piece"/> class.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        public Piece(int x, int y)
            : base(x, y)
        {
        }

        /// <summary>
        /// Gets or sets the color.
        /// </summary>
        /// <value>The color.</value>
        public PieceColor Color { get; set; }
        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Piece"/> is marked.
        /// </summary>
        /// <value><c>true</c> if marked; otherwise, <c>false</c>.</value>
        public bool Marked { get; set; }
        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Piece"/> is selectable.
        /// </summary>
        /// <value><c>true</c> if selectable; otherwise, <c>false</c>.</value>
        public bool Selectable { get; set; }

        /// <summary>
        /// Gets the image URL for the current state of this piece.
        /// </summary>
        /// <returns></returns>
        public Uri GetImageUrl()
        {
            return new Uri(string.Format("/Images/{0}{1}.jpg", this.Color.ToString().ToLower(), this.Marked ? "_marked" : ""), UriKind.Relative);
        }
    }
}
